<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="ot" uri="http://www.ideyatech.com/tides"%>
<%@ taglib prefix="idy" tagdir="/WEB-INF/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt"%>

<idy:bs-iris-header title_webpage="title.program-treatment" arg="${treatment.procedure.name}">
	<link rel="stylesheet" type="text/css" href="${url_style}/iris-paper.css" />
</idy:bs-iris-header>

<div class="page-body">
	<c:if test="${param.action eq 'update'}">
		<div class="alert alert-success">Treatment successfully updated.</div>
	</c:if>
	<div class="paper">
		<div class="paper-header">
			<h4><span class="oranged">${treatment.procedure.name}</span></h4>
		</div>
		<div class="paper-body">
			<dl class="dl-horizontal">
				<dt>Patient</dt>
				<dd><a href="${url_context}/patient.jspx?id=${treatment.patientMedicalProgram.patient.id}">${treatment.patientMedicalProgram.patient.fullName}</a></dd>
				<dt>Parent Program</dt>
				<dd><a href="${url_context}/patient-program.jspx?id=${treatment.patientMedicalProgram.id}">${treatment.patientMedicalProgram.name}</a></dd>
				<dt>Performed by</dt>
				<dd>${treatment.performedBy.prettyName}<c:if test="${empty treatment.performedBy}"><span class="muted">Not specified</span></c:if></dd>
				<dt>Treatment Date</dt>
				<dd><fmt:formatDate value='${treatment.treatmentDate}' pattern="MMMM dd yyyy"/><c:if test="${empty treatment.treatmentDate}"><span class="muted">Not specified</span></c:if></dd>
				<dt>Description</dt>
				<dd>${treatment.description}<c:if test="${empty treatment.description}"><span class="muted">Not specified</span></c:if></dd>
				<dt>&nbsp;</dt>
				<dd>&nbsp;</dd>
				<dt>Result</dt>
				<dd>${treatment.resultStatus.value}</dd>
				<dt>Result Description</dt>
				<dd>${treatment.result}<c:if test="${empty treatment.result}"><span class="muted">Not specified</span></c:if></dd>
				<dt>&nbsp;</dt>
				<dd>&nbsp;</dd>
				<dt>Prescription</dt>
				<dd>${treatment.prescription.advice}<c:if test="${empty treatment.prescription.advice}"><span class="muted">Not specified</span></c:if></dd>
			</dl>
			<hr/>
			<div class="text-center"><h5 class="oranged">Prescribed Medicines</h5></div>
			<dl class="dl-horizontal">
				<c:forEach var="prescribedMedicine" items="${treatment.prescription.prescribedMedicines}">
					<dt>${prescribedMedicine.medicine.name}</dt>
					<dd>${prescribedMedicine.dosage}</dd>
				</c:forEach>
				<c:if test="${empty treatment.prescription.prescribedMedicines}">
					<div class="text-center muted">There are no medicines prescribed.</div>
				</c:if>
			</dl>
		</div>
		<div class="paper-footer">
			<h5><a class="btn btn-primary btn-small" href="${url_context}/program-treatment/form.jspx?id=${treatment.id}&action=update"><icon class="icon-edit icon-white"></icon> Update</a> <a class="btn btn-small" id="delete-program-treatment"><i class="icon-remove"></i> Delete</a></h5>
		</div>
	</div>
</div>

<idy:bs-iris-footer>
	<script type="text/javascript">
		$(document).ready(function(){
			$('#delete-program-treatment').click(function(){
				if(confirm("Are you sure you want to remove this program treatment?")){
					window.location = "${url_context}/program-treatment/delete.jspx?id=${treatment.id}";
				}
			});
		});
	</script>
</idy:bs-iris-footer>